print("Example script dz_cisha.lua.");
---------------------------
local  Touxi= CLASS(Spell)
Touxi.name = '偷袭'
Touxi.target = 'target'
-- ShenJi.zhushou = true

function Touxi:canCast( )
	-- body
	return getDebuffRemainTime('target', '偷袭') < 0.5 and not immune_coma('target')
	-- return true
end
---------------------------
local  ShenJi= CLASS(Spell)          
ShenJi.name = '肾击'
ShenJi.target = 'target'
-- ShenJi.zhushou = true

function ShenJi:canCast( )
	-- body
	 if buffExist('target', '闪避', '剑在人在') and not ObjectIsBehind ('player', 'target') then
	 	return false
	end
	return GetComboPoints('player') >= 4 and 
	getDebuffRemainTime('target', '偷袭') < 0.5 and 
	not immune_coma('target')


	-- return true
end

local shenji = ShenJi.new()
-------------------------
local GeLie = CLASS(Spell)
GeLie.name = '割裂'
GeLie.target = 'target'

function GeLie:canCast( )
	-- body
	return getDebuffRemainTime( self.target, '割裂' ) < 5 
end

---------------------------
local  DuShang= CLASS(Spell)
DuShang.name = '毒伤'
DuShang.target = 'target'

function DuShang:canCast( )
	-- body
	return GetComboPoints('player') >= 4 and UnitPower('player') > 50 
end
---------------------------
local  TianJiangShaJi= CLASS(Spell)
TianJiangShaJi.name = '天降杀机'
TianJiangShaJi.target = 'target'

function TianJiangShaJi:canCast( )
	-- body
	return GetComboPoints('player') >= 4
end

function TianJiangShaJi:beforeCast()
	-- body
	-- SiWangBiaoJi:cast()
end
---------------------------
local HuiShang = CLASS(Spell)
HuiShang.name = '毁伤'
HuiShang.target = 'target'
function HuiShang:canCast()
	-- body
	return true
end
---------------------------
local ZhanJi = CLASS(Spell)
ZhanJi.name = '斩击'
ZhanJi.target = 'target'
function ZhanJi:canCast()
	-- body
	return GetComboPoints('player') < 5
end
---------------------------
local  SuDuBaoFa= CLASS(Spell)
SuDuBaoFa.name = '速度爆发'
SuDuBaoFa.zhushou = true

---------------------------
local  YangGong= CLASS(Spell)
YangGong.name = '佯攻'

function YangGong:canCast( )
	-- body
	return  getBuffRemianTime('player','佯攻') < 1
end
---------------------------
local  MenGun= CLASS(Spell)
MenGun.name = '闷棍'
MenGun.target = 'target'
MenGun.zhushou = true

function MenGun:canCast( )
	-- body
	return  getDebuffRemainTime('target','闷棍') < 2
end
---------------------------
local  FuYuan= CLASS(Spell)
FuYuan.name = '复原'
FuYuan.target = 'player'

function FuYuan:canCast( )
	return  getBuffRemianTime('player','复原') < 8 and GetComboPoints('player') >= 3 
	and  getHpParent('player') < 0.8
end
---------------------------
local  DaoShan= CLASS(Spell)
DaoShan.name = '刀扇'
DaoShan.enable = false

---------------------------
SiWangBiaoJi= CLASS(Spell)
SiWangBiaoJi.name = '死亡标记'

function SiWangBiaoJi:canCast( )
	return GetComboPoints('player') < 4
end
---------------------------
Duren= CLASS(Spell)
Duren.name = '毒刃'
Duren.target = 'target'

function Duren:canCast( )
	return not immune_slowdown(self.target) and GetUnitSpeed("target") > 0
end
---------------------------
ZhiMangOther= CLASS(Spell)
ZhiMangOther.name = '致盲'
ZhiMangOther.target = 'other'

function ZhiMangOther:canCast( )
	return not immune_all(self.target) 
end
---------------------------
ZaojiOther= CLASS(Spell)
ZaojiOther.name = '凿击'
ZaojiOther.target = 'other'

function ZaojiOther:canCast( )
	return not immune_all(self.target) 
end
---------------------------
local CiShaScheme = CLASS(Scheme)
function CiShaScheme:ctor( )
	self:addSpell(FuYuan.new())
	self:addSpell(GeLie.new())
	self:addSpell(Duren.new())
	self:addSpell(TianJiangShaJi.new())
	self:addSpell(DuShang.new())
	self:addSpell(ZhanJi.new())
	self:addSpell(HuiShang.new())

	self:addInterruptSpell(Spell.new('脚踢'))

	self:addToggleSpell(SiWangBiaoJi.new())
	-- self:addToggleSpell(shenji)
	self:addToggleSpell(SuDuBaoFa.new())
	self:addToggleSpell(YangGong.new())
	-- self:addToggleSpell(FuYuan.new())
	self:addToggleSpell(DaoShan.new())
	self:addToggleSpell(Spell.new('宿敌','target'))
	self:addToggleSpell(Spell.new('烟雾弹'))
	local zaoji = Spell.new('凿击', 'target')
	zaoji.zhushou = true
	self:addToggleSpell(zaoji)
	local zhimang = Spell.new('致盲', 'target')
	zhimang.target = 'target'
	zhimang.zhushou = true
	self:addToggleSpell(zhimang)

	self:addToggleSpell(Touxi.new())

	self:addToggleSpell(MenGun.new())
	self:addToggleSpell(Spell.new('毒刃', 'target'))
	self:addToggleSpell(Spell.new('锁喉', 'target'))
	self:addToggleSpell(Spell.new('伺机待发'))

	local xiaoshi = Spell.new('消失')
	xiaoshi.zhushou = true
	self:addToggleSpell(xiaoshi)
end

function CiShaScheme:shenji( )
	-- body
	-- print(getCD('肾击'))
	if getCD('肾击') > 2 then
		self.shenji_enable = false
		return
	end
	local comboPoints = GetComboPoints('player')
	if comboPoints >= 4 then
		shenji:cast()
		return
	end	


	if GetSpellCooldown('肾击') == 0 then
		if SiWangBiaoJi:cast()  then
			return
		end
	end

	HuiShang:cast()
end

function CiShaScheme:update()
	-- body
	if self.shenji_enable then
		self:shenji()
	else
		self.super.update(self)
	end
end
function CiShaScheme:start_shenji()
	self.shenji_enable = true
	self.super.start(self)
end
function CiShaScheme:start( ... )
	-- body
	self.shenji_enable = false
	self.super.start(self, ...)
end
function CiShaScheme:zhimangOther( )
	-- body
	-- self:start()
	self:setFirstSpell(ZhiMangOther)
end
function CiShaScheme:zaojiOther( )
	-- body
	-- self:start()
	self:setFirstSpell(ZaojiOther)
end
schemeMap[41] = CiShaScheme.new()








